use serde::{Deserialize, Serialize};

#[derive(Debug, Serialize, Deserialize)]
#[serde(rename_all = "camelCase")]
pub struct Post {
    pub user_id: i64,
    pub id: i64,
    pub title: String,
    pub body: String,

    #[serde(default)]
    pub foo: i32,
    #[serde(default = "bar_default_value")]
    pub bar: String,
}

pub fn bar_default_value() -> String {
    "Hello, 世界".to_string()
}
